<!--
  
   SystemScreen.xaml
  
   Copyright (c) 2007 Mike Strobel
  
   This source code is subject to the terms of the Microsoft Reciprocal License (Ms-RL).
   For details, see <http://www.opensource.org/licenses/ms-rl.html>.
  
   All other rights reserved.
  
  -->
<ResourceDictionary xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:scc="http://schemas.startreksupremacy.com/xaml/presentation"
                    xmlns:cal="http://www.codeplex.com/CompositeWPF"
                    xmlns:local="clr-namespace:Supremacy.Client"
                    xmlns:s="http://schemas.startreksupremacy.com/xaml/core"
                    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                    xmlns:e="http://schemas.microsoft.com/expression/2010/interactions">

  <!--
    **************************
    * SYSTEM SCREEN TEMPLATE *
    **************************
  -->
  <Style TargetType="{x:Type scc:ColonyScreenView}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type scc:ColonyScreenView}">
          <Border Background="#66000000"
                  Padding="6">
            <Grid>
              <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
              </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="240"
                                  SharedSizeGroup="LeftColumnGroup" />
                <ColumnDefinition Width="0.67*" />
              </Grid.ColumnDefinitions>

              <!-- SUMMARY BUTTON -->
              <Button Grid.Column="0"
                      Style="{StaticResource LCARS_StandardButtonStyle}"
                      Content="{s:StringResource Key=SUMMARY_BUTTON_TEXT, Case=Upper}"
                      Command="{x:Static scc:ClientCommands.ShowEndOfTurnSummary}" />

              <!-- BEGIN SYSTEM SELETION BAR -->
              <Grid Grid.Column="1"
                    Grid.Row="0"
                    Grid.IsSharedSizeScope="False">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto" />
                  <ColumnDefinition Width="Auto" />
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Border Grid.Column="0"
                        Grid.Row="0"
                        Background="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                        CornerRadius="14,0,0,14"
                        Width="21"
                        Margin="3,0,0,0" />
                <ComboBox x:Name="PART_ColonyList"
                          Grid.Column="1"
                          Grid.Row="0"
                          Margin="3,0,0,0"
                          IsEditable="False"
                          IsReadOnly="True"
                          MinWidth="200"
                          DisplayMemberPath="Name"
                          ItemsSource="{Binding Path=Colonies, Mode=OneWay}"
                          SelectedItem="{Binding Path=SelectedColony, Mode=TwoWay}">
                  <ComboBox.Resources>
                    <DataTemplate x:Key="ItemTemplate">
                      <TextBlock Text="{Binding Path=Name, Mode=OneWay, Converter={StaticResource UpperCaseConverter}}" />
                    </DataTemplate>
                  </ComboBox.Resources>
                  <ComboBox.ItemTemplate>
                    <StaticResource ResourceKey="ItemTemplate" />
                  </ComboBox.ItemTemplate>
                </ComboBox>
                <Rectangle Grid.Column="2"
                           Grid.Row="0"
                           Margin="3,0,0,0"
                           Fill="{StaticResource LCARS_BlueGradient_Top_Bottom}" />
                <Border Grid.Column="3"
                        Grid.Row="0"
                        Background="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                        CornerRadius="0,14,14,0"
                        Width="21"
                        Margin="3,0,0,0" />
              </Grid>
              <!-- END SYSTEM SELETION BAR -->

              <!-- BEGIN OBJECT INFO BAR -->
              <Grid Grid.Column="0"
                    Grid.Row="1"
                    Grid.RowSpan="2"
                    Margin="0,4,0,0"
                    TextBlock.FontFamily="{StaticResource LCARS_ParagraphFont}"
                    TextBlock.Foreground="{StaticResource LCARS_BeigeTextBrush}">
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="*" />
                  <RowDefinition Height="2*" />
                </Grid.RowDefinitions>
                <Expander Grid.Row="0"
                          cal:RegionManager.RegionName="{x:Static scc:ColonyScreenRegions.ColonyInfo}"
                          VerticalAlignment="Top"
                          FontFamily="{StaticResource LCARS_DefaultFont}"
                          Header="{Binding Source={s:StringResource SYSTEM_INFO}, Mode=OneTime, Converter={StaticResource UpperCaseConverter}}"
                          FontSize="14pt"
                          IsExpanded="True">
                </Expander>
                <!-- BEGIN BUILD QUEUE AREA -->
                <Expander Grid.Row="1"
                          Grid.RowSpan="2"
                          cal:RegionManager.RegionName="{x:Static scc:ColonyScreenRegions.PlanetaryBuildQueue}"
                          Margin="0,4,0,0"
                          Header="BUILD QUEUE"
                          IsExpanded="True">
                </Expander>
                <!-- END BUILD QUEUE AREA -->
              </Grid>
              <!-- END OBJECT INFO BAR -->

              <!-- BEGIN PRIMARY CONTENT AREA -->
              <TabControl x:Name="SystemTabs"
                          Grid.Column="1"
                          Grid.Row="1"
                          Margin="4,4,0,4"
                          FontFamily="{StaticResource LCARS_ParagraphFont}"
                          FontSize="11pt">
                <i:Interaction.Triggers>
                  <e:DataTrigger Binding="{Binding ElementName=SystemTabs, Path=IsVisible}"
                                 Comparison="Equal"
                                 Value="True">
                    <e:ChangePropertyAction TargetObject="{x:Reference SystemTabs}"
                                            PropertyName="SelectedIndex"
                                            Value="0" />
                  </e:DataTrigger>
                </i:Interaction.Triggers>
                <TabItem x:Name="ProductionTab"
                         cal:RegionManager.RegionName="{x:Static scc:ColonyScreenRegions.ProductionManagement}"
                         Header="PRODUCTION">
                </TabItem>
                <TabItem x:Name="StructuresTab"
                         Header="STRUCTURES">
                  <ContentControl cal:RegionManager.RegionName="{x:Static scc:ColonyScreenRegions.StructureList}" />
                </TabItem>
                <TabItem x:Name="BuildListTab"
                         Header="BUILD LIST">
                  <!-- BEGIN BUILD LIST PANEL -->
                  <Grid>
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="*" />
                      <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                      <RowDefinition Height="Auto" />
                      <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <ContentControl Grid.Column="0"
                                    Grid.Row="0"
                                    Grid.RowSpan="2"
                                    cal:RegionManager.RegionName="{x:Static scc:ColonyScreenRegions.PlanetaryBuildList}" />
                    <ContentControl Style="{StaticResource LCARS_ThinBorderStyle}"
                                    VerticalAlignment="Top"
                                    Grid.Column="1"
                                    Grid.Row="0"
                                    Margin="14,0,0,0">
                      <Image Stretch="Uniform"
                             Width="270"
                             Height="225">
                        <Image.Source>
                          <Binding Path="SelectedPlanetaryBuildProject.BuildDesign"
                                   Mode="OneWay"
                                   Converter="{StaticResource TechObjectImageConverter}">
                          </Binding>
                        </Image.Source>
                      </Image>
                    </ContentControl>
                    <ContentControl cal:RegionManager.RegionName="{x:Static scc:ColonyScreenRegions.SelectedPlanetaryBuildProjectInfo}"
                                    Grid.Column="1"
                                    Grid.Row="1"
                                    DataContext="{Binding Path=SelectedPlanetaryBuildProject, Mode=OneWay}"
                                    Margin="14,4,0,0" />
                  </Grid>
                  <!-- END BUILD LIST PANEL -->
                </TabItem>
                <TabItem x:Name="ShipbuildingTab"
                         Header="SHIPBUILDING">
                  <!-- BEGIN SHIPBUILDING QUEUE -->
                  <Grid x:Name="ShipbuildingTabContent">
                    <ItemsControl ItemsSource="{Binding Path=SelectedColony.Shipyard.BuildSlots, Mode=OneWay}">
                      <ItemsControl.ItemTemplate>
                        <DataTemplate DataType="{x:Type s:ShipyardBuildSlot}">
                          <scc:ShipyardDockView BuildSlot="{Binding}" Margin="16" HorizontalAlignment="Left" />
                        </DataTemplate>
                      </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    <!--<Grid.ColumnDefinitions>
                      <ColumnDefinition Width="*" />
                      <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                      <RowDefinition />
                      <RowDefinition MinHeight="200" />
                    </Grid.RowDefinitions>
                    <ContentControl Style="{StaticResource LCARS_ThinBorderStyle}"
                                    Grid.Column="0"
                                    Grid.Row="0"
                                    Margin="0,0,4,4">
                      <ScrollViewer CanContentScroll="False">
                        <ContentControl cal:RegionManager.RegionName="{x:Static scc:ColonyScreenRegions.ShipyardBuildQueue}"
                                          Margin="0,0,7,0" />
                      </ScrollViewer>
                    </ContentControl>

                    <ContentControl Style="{StaticResource LCARS_ThinBorderStyle}"
                                    Grid.Column="0"
                                    Grid.Row="1"
                                    Margin="0,0,4,0">
                      <DockPanel LastChildFill="True">
                        <TextBlock DockPanel.Dock="Top"
                                   FontFamily="{StaticResource LCARS_DefaultFont}"
                                   FontSize="18pt"
                                   Foreground="{StaticResource LCARS_BlueTextBrush}"
                                   Text="{s:StringResource Key=SHIPYARD_BUILD_LIST, Case=Upper}" />
                        <ContentControl cal:RegionManager.RegionName="{x:Static scc:ColonyScreenRegions.ShipyardBuildList}"
                                        HorizontalAlignment="Stretch"
                                        HorizontalContentAlignment="Stretch"/>
                      </DockPanel>
                    </ContentControl>
                    

                    <Grid Grid.Column="1"
                          Grid.Row="0"
                          Grid.RowSpan="2">
                      <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                      </Grid.RowDefinitions>
                      <ContentControl Style="{StaticResource LCARS_ThinBorderStyle}"
                                      VerticalAlignment="Top"
                                      Grid.Row="0"
                                      Margin="0,0,0,0">
                        <Image Stretch="Uniform"
                               Width="270"
                               Height="225"
                               Source="{Binding Path=SelectedShipyardBuildProject.BuildDesign.Image, Mode=OneWay}" />
                      </ContentControl>
                      <ContentControl cal:RegionManager.RegionName="{x:Static scc:ColonyScreenRegions.SelectedShipyardBuildProjectInfo}"
                                      Grid.Row="1"
                                      DataContext="{Binding Path=SelectedShipyardBuildProject, Mode=OneWay}"
                                      Margin="0,4,0,0" />
                    </Grid>-->
                  </Grid>
                    <!-- END SHIPBUILDING PANEL -->
                </TabItem>
              </TabControl>
              <!-- END PRIMARY CONTENT AREA -->


              <!-- BEGIN SYSTEM VIEW -->
              <ContentControl Style="{StaticResource LCARS_ThinBorderStyle}"
                              Grid.Column="1"
                              Grid.Row="2"
                              Margin="4,0,0,0">
                <ContentControl cal:RegionManager.RegionName="{x:Static scc:CommonGameScreenRegions.PlanetsView}"
                                DataContext="{Binding Path=SelectedColony.Sector}"
                                Height="128" />
              </ContentControl>
              <!-- END SYSTEM VIEW -->
            </Grid>
          </Border>
          <ControlTemplate.Triggers>
            <MultiDataTrigger>
              <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding Path=SelectedColony.Shipyard, Mode=OneWay}"
                           Value="{x:Null}" />
              </MultiDataTrigger.Conditions>
              <Setter TargetName="ShipbuildingTab"
                      Property="IsEnabled"
                      Value="False" />
              <Setter TargetName="ShipbuildingTab"
                      Property="IsSelected"
                      Value="False" />
              <Setter TargetName="ShipbuildingTabContent"
                      Property="Visibility"
                      Value="Hidden" />
            </MultiDataTrigger>
            <DataTrigger Binding="{Binding Path=ClientContext.IsTurnFinished, RelativeSource={RelativeSource TemplatedParent}}"
                         Value="True">
              <Setter Property="IsEnabled"
                      Value="False" />
            </DataTrigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

</ResourceDictionary>